package com.gc.business.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.gc.common.utils.StringUtils;
import org.springframework.stereotype.Service;
import com.gc.business.mapper.InventoryInfoMapper;
import com.gc.business.domain.InventoryInfo;
import com.gc.business.service.IInventoryInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;

/**
 * 库存管理 服务层实现
 * 
 * @author hruiyan
 * @date 2020-11-10
 */
@Slf4j
@Service
public class InventoryInfoServiceImpl extends ServiceImpl<InventoryInfoMapper, InventoryInfo> implements IInventoryInfoService {

    @Override
    public List<InventoryInfo> list(InventoryInfo inventoryInfo){
        LambdaQueryWrapper<InventoryInfo> wrapper = new LambdaQueryWrapper<>();
        if(inventoryInfo != null){
            if(StringUtils.isNotEmpty(inventoryInfo.getInventoryId())){
                wrapper.eq(InventoryInfo::getInventoryId, inventoryInfo.getInventoryId());
            }
            if(StringUtils.isNotEmpty(inventoryInfo.getAttrId())){
                wrapper.eq(InventoryInfo::getAttrId, inventoryInfo.getAttrId());
            }
            if(StringUtils.isNotEmpty(inventoryInfo.getOrderNo())){
                wrapper.eq(InventoryInfo::getOrderNo, inventoryInfo.getOrderNo());
            }
            if(StringUtils.isNotEmpty(inventoryInfo.getItemName())){
                wrapper.like(InventoryInfo::getItemName, inventoryInfo.getItemName());
            }
            if(StringUtils.isNotEmpty(inventoryInfo.getItemNum())){
                wrapper.eq(InventoryInfo::getItemNum, inventoryInfo.getItemNum());
            }
            if(StringUtils.isNotEmpty(inventoryInfo.getItemSum())){
                wrapper.eq(InventoryInfo::getItemSum, inventoryInfo.getItemSum());
            }
            if(StringUtils.isNotEmpty(inventoryInfo.getItemAgent())){
                wrapper.like(InventoryInfo::getItemAgent, inventoryInfo.getItemAgent());
            }
            if(StringUtils.isNotEmpty(inventoryInfo.getStorageTime())){
                wrapper.eq(InventoryInfo::getStorageTime, inventoryInfo.getStorageTime());
            }
            if(StringUtils.isNotEmpty(inventoryInfo.getOperationTime())){
                wrapper.eq(InventoryInfo::getOperationTime, inventoryInfo.getOperationTime());
            }
            if(StringUtils.isNotEmpty(inventoryInfo.getCreateBy())){
                wrapper.eq(InventoryInfo::getCreateBy, inventoryInfo.getCreateBy());
            }
            if(StringUtils.isNotEmpty(inventoryInfo.getCreateTime())){
                wrapper.eq(InventoryInfo::getCreateTime, inventoryInfo.getCreateTime());
            }
            if(StringUtils.isNotEmpty(inventoryInfo.getUpdateBy())){
                wrapper.eq(InventoryInfo::getUpdateBy, inventoryInfo.getUpdateBy());
            }
            if(StringUtils.isNotEmpty(inventoryInfo.getUpdateTime())){
                wrapper.eq(InventoryInfo::getUpdateTime, inventoryInfo.getUpdateTime());
            }
            if(StringUtils.isNotEmpty(inventoryInfo.getRemark())){
                wrapper.eq(InventoryInfo::getRemark, inventoryInfo.getRemark());
            }
        }
        return baseMapper.selectList(wrapper);
    }
}
